import {createRouter, createWebHistory, Router, RouteRecordRaw} from 'vue-router';

const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        redirect: "/login",
        name: "login",
        children: [
            {
                path: "/login",
                name: "Login",
                component: () => import('../views/login/LoginView.vue')
            },
            {
                path: "/register",
                name: "register",
                component: () => import('../views/login/registerView.vue')
            },
        ]
    },
    {
        path: "/user",
        redirect: "/user/userHomepage",
        name: "user",
        component: () => import('../layout/userLayout.vue'),
        children: [
            {
                path: "userHomepage",
                name: 'userHomepage',
                component: () => import('../views/user/userHomepage.vue')
            },
            {
                path: "userServer",
                name: 'userServer',
                component: () => import('../views/user/userServer.vue'),
            },
            {
                path:"userDetail/:id",
                name:'userDetail',
                component: () => import('../views/user/userReMarkpage.vue')
            }
        ]
    },
    {
        path: "/admin",
        redirect: "/admin/companyMa",
        name: "admin",
        component: () => import('../layout/appLayout.vue'),
        children: [
            {
                path: "companyMa",
                name: 'companyManage',
                component: () => import('../views/company/companyMaIndex.vue')
            },
            {
                path: "houseWorkMa",
                name: 'houseWorkManage',
                component: () => import('../views/HouseWorkManage/HouseWorkMaIndex.vue')
            },
            {
                path: "userMa",
                name: 'userManage',
                component: () => import('../views/userManage/userMaIndex.vue')
            },
            {
                path: "serverMa",
                name: 'serverManage',
                component: () => import('../views/serverType/serverMalIndex.vue')
            }
        ]
    },

]
const router: Router = createRouter({
    history: createWebHistory(),
    routes
})

export default router;